<?php
// connect
require 'connect.php';

  mysql_select_db("lyubishchev", $con);
  
  $result = mysql_query("SELECT * FROM Log");
echo "<table border='1'>";
while($row = mysql_fetch_array($result))
  {
  	$phptimee=strtotime($row['end']);
	$phptimes=strtotime($row['start']);
	$de = $row['description'];
	$id = $row['ID'];
	
	$durtime = $phptimee - $phptimes;
	$durHour = floor($durtime/3600);
	$durMinute = ($durtime/60)%60;
	$hourString = $durHour==0?"":$durHour."h";
	
  echo "<tr><td>No." . $id . "</td> <td>" . date("h:i",$phptimes) . "</td> <td>" .$hourString . $durMinute . "m</td> <td>" . $de . "</td></tr>";
  
  }
  echo "</table>";
  
  // close db
mysql_close($con);
echo "<a href='index.html'>back</a>";

?>